package com.chenjt.jvm.third.jprofiler;

import java.util.ArrayList;
import java.util.concurrent.TimeUnit;

/**
 * 注释：
 *
 * @author chenjt
 * @date 2025/7/11 8:49
 */
public class MemoryLeak {

    public static void main(String[] args) {
        while(true){
            ArrayList beanList = new ArrayList();
            for (int i = 0; i < 500; i++) {
                Bean data = new Bean();
                data.list.add(new byte[1024 * 10]);// 10KB
                beanList.add(data);
            }

            try {
                TimeUnit.MILLISECONDS.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
    }

}


class Bean{
    int size = 10;
    String info = "hello world";
    static ArrayList list = new ArrayList();
}
